package com.pinc.poop;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

public abstract class PincCalendarGridView extends RelativeLayout {
	protected TextView tv_day;
	public int monthDay = 1;
	public boolean isCurMonth = false;
	public boolean isToday = false;
	public View.OnClickListener listener = null;

	public PincCalendarGridView(Context context, AttributeSet attrs) {
		super(context, attrs);
		LayoutInflater.from(context).inflate(getLayoutResource(), this, true);
		tv_day =  (TextView) findViewById(getDayViewId());
	}

	protected abstract int getLayoutResource();
	protected abstract int getDayViewId();
	protected int getColorCurMonth(){ return Color.BLACK; };
	protected int getColorToday(){ return Color.RED; };
	protected int getColorDefault(){ return Color.GRAY; };

	public void updateBaseView()
	{
		if ( isToday)
			tv_day.setTextColor(getColorToday());
		else if ( isCurMonth )
			tv_day.setTextColor(getColorCurMonth());
		else
			tv_day.setTextColor(getColorDefault());

		tv_day.setText(String.valueOf(monthDay));
		this.setOnClickListener(listener);
	}

}
